<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <style>
    .active {
      color: red;
    }
  </style>
</head>
<body>

<div id="app">
  <!--  <h1 class="active">{{message}}</h1>-->
  <!--  <h1 :class="active">{{message}}</h1>-->
  <h1 v-bind:class="{active : isActive,unactive : isUnActive}">{{message}}</h1>
  <h1 v-bind:class="getClasses()">{{message}}</h1>
  <button @click="button">按钮</button>
</div>

<script src="../js/vue.js"></script>
<script>
  //let(变量)和const(常量)
  const app = new Vue({
    el: '#app',
    data: {
      message: '中国牛蛙！',
      isActive: true,
      isUnActive: false
    },
    methods: {
      button: function () {
        this.isActive = !this.isActive;
      },
      getClasses: function () {
        return {active: this.isActive, unactive: this.isUnActive}
      }
    }
  })
</script>
</body>
</html>